﻿// =================================================================== 
// 项目说明
//====================================================================
// lsc @Copy Right 2019
// 文件： GcGroupRepository.cs
// 项目名称：斑马车务
// 创建时间：2019/10/28
// 负责人：lsc
// ===================================================================
using System;
using System.Text;
using System.Collections.Generic;
using YouWei.Infrastructure.Entity;

namespace YouWei.Infrastructure.Repository
{
	/// <summary>
	///微信群 仓储层
	/// </summary>	
	public class GcGroupRepository:BaseRepository<GcGroup>
	{		
    
        #region 构造

        public GcGroupRepository() : base(){}

        public GcGroupRepository(string connectionString) : base(connectionString){}

        public GcGroupRepository(DatabaseContext dbContext) : base(dbContext){}

        #endregion

        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="wxid"></param>
        /// <returns></returns>
        public GcGroup GetInfoByWxId(string wxid)
        {
            StringBuilder sb = new StringBuilder("SELECT * FROM GcGroup T WITH(NOLOCK) ");
            sb.Append(" WHERE T.wxid = @wxid");
            return FirstOrDefault(sb.ToString(), new { wxid = wxid });
        }

        /// <summary>
        /// 获取详情
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public GcGroup GetInfoByName(string name)
        {
            StringBuilder sb = new StringBuilder("SELECT * FROM GcGroup T WITH(NOLOCK) ");
            sb.Append(" WHERE T.nickname = @nickname");
            return FirstOrDefault(sb.ToString(), new { nickname = name });
        }
    }
}